package _08作业.t1;

import java.io.IOException;
import java.net.*;

public class UDPSender {
    public static void main(String[] args) throws IOException {
        //1.创建 发送端
        DatagramSocket datagramSocket = new DatagramSocket();

        //2.创建数据包
        byte[] bytes = "你好，接收端".getBytes();
        InetAddress ip = InetAddress.getByName("127.0.0.1");

        //3.发送数据
        DatagramPacket datagramPacket = new DatagramPacket(bytes,0,bytes.length,ip,9999);
        datagramSocket.send(datagramPacket);

        datagramSocket.close();

    }
}
